<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>无标题文档</title>
    <link href="{:config('admin_static')}/css/style.css" rel="stylesheet" type="text/css" />
    <link href="{:config('admin_static')}/css/page.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="{:config('admin_static')}/js/jquery.js"></script>
    <script type="text/javascript" src="/plugin/layer/layer.js"></script>
    <script type="text/javascript">
        

    </script>
    <script type="text/javascript">
    $(document).ready(function() {
        $(".click").click(function() {
            $(".tip").fadeIn(200);
        });

        $(".tiptop a").click(function() {
            $(".tip").fadeOut(200);
        });

        $(".sure").click(function() {
            $(".tip").fadeOut(100);
        });

        $(".cancel").click(function() {
            $(".tip").fadeOut(100);
        });

    });
    </script>
</head>

<body>
    <div class="place">
        <span>位置：</span>
        <ul class="placeul">
            <li><a href="#">首页</a></li>
            <li><a href="#">数据表</a></li>
            <li><a href="#">基本内容</a></li>
        </ul>
    </div>
    <div class="rightinfo">
        <div class="tools">
            <ul class="toolbar">
                <li><span><img src="{:config('admin_static')}/images/t01.png" /></span>添加</li>
                <li><span><img src="{:config('admin_static')}/images/t02.png" /></span>修改</li>
                <li><span><img src="{:config('admin_static')}/images/t03.png" /></span>删除</li>
                <li><span><img src="{:config('admin_static')}/images/t04.png" /></span>统计</li>
            </ul>
        </div>
        <!--搜索开始 Start-->
        <form method="get" style="margin-bottom: 10px;">
            输入收货人\电话\订单号\地址:
            <input placeholder="输入收货人\电话\订单号\地址" class="dfinput" type="text" name="keyword" id="keyword">
            <input type="button" class="dfinput" style="width:100px;" id="search" value="查询">
        </form>
        <!--搜索结束 Stop-->
        <table class="tablelist">
            <thead>
                <tr>
                    <th>
                        <input name="" type="checkbox" value="" id="checkAll" />
                    </th>
                    <th>订单号</th>
                    <th>购买人</th>
                    <th>收货人/收货地址</th>
                    <th>电话/邮编</th>
                    <th>总金额</th>
                    <th>付款状态</th>
                    <th>发货状态</th>
                    <th>操作</th>
                </tr>
            </thead>
            <tbody>
                {include file='order/tbody'  /}
            </tbody>
        </table>
        <div class="pagination">
            {$lists->render()}
        </div>
        <div class="tip">
            <div class="tiptop"><span>提示信息</span>
                <a></a>
            </div>
            <div class="tipinfo">
                <span><img src="{:config('admin_static')}/images/ticon.png" /></span>
                <div class="tipright">
                    <p>是否确认对信息的修改 ？</p>
                    <cite>如果是请点击确定按钮 ，否则请点取消。</cite>
                </div>
            </div>
            <div class="tipbtn">
                <input name="" type="button" class="sure" value="确定" />&nbsp;
                <input name="" type="button" class="cancel" value="取消" />
            </div>
        </div>
    </div>
    <script type="text/javascript">
        $('.tablelist tbody tr:odd').addClass('odd');
        //ajax无刷新分页(使用委托方式绑定单击事件，让后续新来的元素也有单击事件)
        $(".pagination").on('click','a',function(){
            var href = $(this).attr('href');
            var keyword = $("input[name='keyword']").val();
            //基于变量的正则只能使用new来创建
            var reg = new RegExp(keyword,'g');
            //替换主题和分页页码数据
            if(keyword){
                $("tbody").html(json.tbody.replace(reg,"<span style='color: red;font-size: 20px'>"+keyword+""));
            }else{
                $("tbody").html(json.tbody);
            }
            //阻止a标签的默认行为(禁止a标签跳转)
            $.get(href,{"keyword":keyword},function(json){
                console.log(json);
                //把返回的数据，进行替换即可
                $(".pagination").html(json.pagelist);
                $("tbody").html(json.tbody);
            },'json')
            return false;
        });

        //ajax查询
        $("#search").click(function(){
            var keyword = $("input[name='keyword']").val();
            //发送ajax请求
            $.get("{:url('admin/order/index')}",{"keyword":keyword},function(json){
                //基于变量的正则只能使用new来创建
                var reg = new RegExp(keyword,'g');
                //替换主题和分页页码数据
                if(keyword){
                    $("tbody").html(json.tbody.replace(reg,"<span style='color: red;font-size: 20px'>"+keyword+"</span>"));
                }else{
                    $("tbody").html(json.tbody);
                }
                $("pagination").html(json.pagelist);
                },'json');
        });

        //ajax查询物流信息
        //事件委托
        $('tbody').on('click','.logistics',function(){
            var company = $(this).attr('company');
            var number = $(this).attr(number);
            var param = {"company":company,"number":number};
            $.get("{:url('admin/order/queryLogistics')}",param,function (text) {
                // console.log(text);
                layer.open({
                    type:2,
                    title:'物流信息:',
                    shadeClose:true,
                    shade:0.8,
                    area:['650px','550px'],
                    content:text  //iframe 的 url
                });
            },'text');
        });
    </script>
</body>

</html>
